// https://www.lintcode.com/problem/is-subsequence/my-submissions

class Solution {
public:
    /**
     * @param s: the given string s
     * @param t: the given string t
     * @return: check if s is subsequence of t
     */
    bool isSubsequence(string &s, string &t) {
        if (s.empty()) return true;
        if (t.empty()) return false;
        int i = 0;
        int j = 0;
        for (; i < t.length(); ++i)
        {
            if (t[i] == s[j])
            {
                ++j;
                if (j == s.length())
                {
                    return true;
                }
            }
        }
        return false;
    }
};